<!DOCTYPE HTML>
<html>

<head>
  <meta charset="utf-8">
  <style>
    .external {
      background-color: yellow;
    }
  </style>
</head>

<body>


  <a name="list">список</a>
  <ul>
    <li><a href="http://google.com">http://google.com</a></li>
    <li><a href="/tutorial">/tutorial.html</a></li>
    <li><a href="local/path">local/path</a></li>
    <li><a href="ftp://ftp.com/my.zip">ftp://ftp.com/my.zip</a></li>
    <li><a href="http://nodejs.org">http://nodejs.org</a></li>
    <li><a href="http://internal.com/test">http://internal.com/test</a></li>
  </ul>


  <script>
    var css = 'a[href*="://"]:not([href^="http://internal.com"])';
    var links = document.querySelectorAll(css);

    for (var i = 0; i < links.length; i++) {
      links[i].classList.add('external');
    }
  </script>

</body>

</html>